#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/socket.h>

#define log(fp, format, args...);   \
    fprintf(fp, format, __FILE__, __LINE__, __func__, ##args);
int i = 0;

void SonProcess()
{
    for ( ; ; ) { 
        i = i + 10;
        std::cout<<"son i:"<<i<<"\n";
        sleep(1);
    }
}

int main()
{
    int statu;
    pid_t pid = fork();
    
    switch (pid) {
        case -1:
            break;
        case 0:
            SonProcess();
            break;
        default: break;            
    }
    
    for( ; ;) {
        i = i+2;    
        std::cout<<"parent i:"<<i<<"\n";
        sleep(1);
    }
    wait(&statu);
    
    return 0;
}
		
		
//#define log() http_sprintf()

/*
int http_sprintf() 
{
	FILE *fp;
	fp = fopen("/tmp/httpd.log", "a");
	fprintf(fp, "%s:%d:%s \"format\"\n", __FILE__, __LINE__, __func__);
	fclose(fp);
	return 0;
}
*/		
